import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { UserEntityModel } from '../model/user.entity';
import { UserDTO } from '../model/user.dto';

@Injectable()
export class PersonService {
  @InjectModel('Cat') private readonly catModel: Model<UserEntityModel>;

  async create(person: UserDTO): Promise<UserEntityModel> {
    let model = new UserDTO();
    model.name = 'zhanshan';
    model.pwd = '123456';
    let user = new this.catModel(model);
    return await user.save();
  }
}
